<template>
  <div class="app-container">

    <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="70px">

      <el-form-item label="计划名称"  prop="name">
        <el-input prefix-icon="el-icon-search" v-model="queryParams.name" placeholder="搜索计划名称" style="width:120px;"/>
      </el-form-item>
      <el-form-item label="营销类型" prop="type">
        <el-select v-model="queryParams.type" placeholder="请选择营销类型" clearable size="small" style="width:120px;">
          <el-option
            v-for="dict in equityTypeOptions"
            :key="dict.dictValue"
            :label="dict.dictLabel"
            :value="dict.dictValue"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="时间区间" prop="beginDate">
        <el-date-picker
          v-model="dateRange"
          size="small"
          style="width: 240px"
          value-format="yyyy-MM-dd"
          type="daterange"
          range-separator="-"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
        ></el-date-picker>
      </el-form-item>
      <el-form-item label="执行状态" prop="type">
        <el-select v-model="queryParams.status" placeholder="请选执行状态" clearable size="small" style="width:120px;">
          <el-option
            v-for="dict in statusOptions"
            :key="dict.dictValue"
            :label="dict.dictLabel"
            :value="dict.dictValue"
          />
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="success" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
      </el-form-item>
      <el-form-item style="float: right">
        <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd">创建计划</el-button>
      </el-form-item>
    </el-form>


    <el-table v-loading="loading" :data="planList" @selection-change="handleSelectionChange">
      <el-table-column label="计划ID" align="left" prop="id" width="100"/>
      <el-table-column label="状态/名称/起止日期" align="left" prop="name">
        <template slot-scope="scope">
          <span><el-button
            size="mini"
            type="text"
            icon="el-icon-circle-check"
          ></el-button>{{ scope.row.name }}</span><br/>
          <span style="font-size:8px;" v-if="scope.row.touchType==1">{{ parseTime(scope.row.touchDate, '{y}-{m}-{d}') }} -{{ scope.row.touchTime }}</span>
          <span style="font-size:8px;" v-if="scope.row.touchType==2">{{ parseTime(scope.row.beginDate, '{y}-{m}-{d} {h}:{i}:{s}') }} -{{ parseTime(scope.row.endDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="类型" align="left" prop="type">
        <template slot-scope="scope">
          <span><el-button
            size="mini"
            type="text"
            icon="el-icon-alarm-clock"
          ></el-button>{{scope.row.touchType==1?'定时型 - 单次':'定时型 - 重复'}}</span>
        </template>
      </el-table-column>
<!--      <el-table-column label="触达通道" align="left" prop="channel">
        <template slot-scope="scope">
          <span>微信服务号模板消息</span><br/>
          <span style="font-size:8px;">{{scope.row.channel}}</span>
        </template>
      </el-table-column>-->
      <el-table-column label="营销类型" align="center" prop="type"  :formatter="equityTypeFormat" >
      </el-table-column>
      <el-table-column label="人群类别" align="left" prop="personType"  >
        <template slot-scope="scope">
          <span><el-button
            size="mini"
            type="text"
            icon="el-icon-s-custom"
          ></el-button>{{scope.row.personType==1?'自有人群':'其他'}}</span><br/>
        </template>
      </el-table-column>
      <el-table-column label="执行状态" align="left" prop="status"  :formatter="statusFormat" > </el-table-column>
<!--      <el-table-column label="整体目标完成率" align="center" prop="allPercent">
        <template slot-scope="scope">
          <span>策略组 14.99%</span><br/>
        </template>
      </el-table-column>-->

      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
<!--          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['operate:plan:edit']"
          >复制
          </el-button>-->
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['operate:plan:remove']"
          >删除
          </el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改运营计划对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="900px" v-if="open"
               :close-on-click-modal="false" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="120px" style="height:700px;">
        <el-card class="box-card">
          <el-row>
            <el-steps :active="active" :finish-status="finshStatus">
              <el-step title="触发条件" icon="el-icon-s-promotion"></el-step>
              <el-step title="目标人群" icon="el-icon-s-custom"></el-step>
              <el-step title="渠道配置" icon="el-icon-setting"></el-step>
            </el-steps>
          </el-row>
        </el-card>
        <el-card class="box-card" v-if="active==0 || active==1" style="height:80%;">

          <el-form-item label="投放计划名称" prop="name" style="width:450px;">
            <el-input v-model="form.name" placeholder="请输入名称"/>
          </el-form-item>
          <el-form-item label="营销类型" class="is-required">
            <el-radio-group v-model="form.type" @change="equityTypeChange">
              <el-radio
                v-for="dict in equityTypeOptions"
                :key="dict.cardCode"
                :label="dict.cardCode"
                border
              >{{dict.cardType}}</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="卡券" prop="type">
            <el-select v-model="form.typeItem" placeholder="请选择卡券" clearable size="small" style="width:300px;">
              <el-option
                v-for="dict in equityitemOptions"
                :key="dict.itemCode"
                :label="dict.itemName"
                :value="dict.itemCode">
                <span style="float: left">{{ dict.itemCode }} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{ dict.itemAmount }}</span>
                <span style="float: right; color: #8492a6; font-size: 13px">{{ dict.itemName }}</span>
              </el-option>
            </el-select>
          </el-form-item>

          <el-form-item label="数量" prop="name">
            <el-input v-model="form.equityNum" placeholder="请输入数量" type="number" controls-position="right" style="width:250px;"/>
          </el-form-item>
          <el-form-item label="面值" prop="content">
            <el-input v-model="form.equitySize" placeholder="请输入面值"type="number" controls-position="right"style="width:250px;"/>
          </el-form-item>
          <el-form-item label="类型" class="is-required">
            <!--          <el-select v-model="form.type" placeholder="请选择类型">
                        <el-option
                          v-for="dict in typeOptions"
                          :key="dict.dictValue"
                          :label="dict.dictLabel"
                          :value="dict.dictValue"
                        ></el-option>
                      </el-select>-->
            <el-radio-group v-model="typeValue">
              <el-radio label="1" v-model="form.touchType" border>定时型 - 单次</el-radio>
              <el-radio label="2" v-model="form.touchType" border>定时型 - 重复</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="触发时间" prop="beginDate" v-show="typeValue==1">
            在
            <el-date-picker
              v-model="form.touchDate"
              type="date"
              value-format="yyyy-MM-dd"
              placeholder="选择日期">
            </el-date-picker>
            <el-time-select
              v-model="form.touchTime"
              :picker-options="{
                    start: '06:00',
                    step: '00:10',
                    end: '24:00'
                  }"
              placeholder="触发时间">
            </el-time-select>&nbsp;&nbsp;对受众用户进行触达
          </el-form-item>
          <el-form-item label="触发时间" prop="touchDateType" v-show="typeValue==2">
            在
            <el-select v-model="form.touchDateType" style="width:80px">
              <el-option value="1" label="每天">每天</el-option>
              <el-option value="2" label="每周">每周</el-option>
              <el-option value="3" label="每月">每月</el-option>
            </el-select>
            <el-select v-model="form.touchDateValue" style="width:100px" v-if="form.touchDateType==2">
              <el-option value="7" label="星期日">星期日</el-option>
              <el-option value="1" label="星期一">星期一</el-option>
              <el-option value="2" label="星期二">星期二</el-option>
              <el-option value="3" label="星期三">星期三</el-option>
              <el-option value="4" label="星期四">星期四</el-option>
              <el-option value="5" label="星期五">星期五</el-option>
              <el-option value="6" label="星期六">星期六</el-option>
            </el-select>
            <el-select v-model="form.touchDateValue" style="width:100px" v-if="form.touchDateType==3">
              <el-option
                v-for="day in this.currentDays"
                :key="day"
                :label="day"
                :value="day"
              ></el-option>
            </el-select>
            <el-time-select
              v-model="form.touchTime"
              :picker-options="{
                    start: '06:00',
                    step: '00:10',
                    end: '24:00'
                  }"
              placeholder="触发时间">
            </el-time-select>
            &nbsp;&nbsp;对受众用户进行触达
          </el-form-item>

          <el-form-item label="起止时间" prop="dateRange" v-show="typeValue==2">
            <el-date-picker
              v-model="form.dateRange"
              size="small"
              style="width: 240px"
              value-format="yyyy-MM-dd"
              type="daterange"
              range-separator="-"
              start-placeholder="开始日期"
              end-placeholder="结束日期"
            ></el-date-picker>
          </el-form-item>
          <el-form-item label="参与限制" v-show="typeValue==2">
            <el-radio v-model="form.partLimit" label="1">参与1次</el-radio>
            <el-radio v-model="form.partLimit" label="2">重复参与</el-radio>
<!--            <br/><span v-if="form.partLimit==1">当前计划  同一用户，仅参与一次</span>
            <span v-if="form.partLimit==2">同一个用户<el-input type="number" v-model="form.partLimitDays" style="width:100px;"></el-input>天内，最多参与
                <el-input type="number" v-model="form.partLimitTimes" style="width:100px;"></el-input>次</span>-->
          </el-form-item>
        </el-card>

        <el-card class="box-card" v-show="active==2" style="height:80%;">
          <span style="font-weight: bold">受众用户为满足一下条件的用户(必选)
            <el-tooltip class="item" effect="dark" content="受众用户为满足一下条件的用户(必选) " placement="top-start">
              <i class="el-icon-question filterItem"></i>
            </el-tooltip>
            </span>
          <el-divider></el-divider>
          <el-form-item label="定向人群" prop="name">
            <el-radio-group v-model="userTypeValue" @change="selectCustType">
              <el-radio label="1" v-model="form.personType" border>自有人群</el-radio>
              <!--              <el-radio label="2" border>商圈</el-radio>
                            <el-radio label="3" border>地域</el-radio>
                            <el-radio label="4" border>城市</el-radio>-->
            </el-radio-group>
          </el-form-item>
          <el-row>
            <el-button type="primary" icon="el-icon-circle-check" size="mini" @click="handleSelectAll">单页全选</el-button>
            <el-button type="success" icon="el-icon-remove" size="mini" @click="handleRemoveAll">清空</el-button>
            <span>已选择<span style="color:red;">{{ selectLength }}</span>项</span>
          </el-row>
          <el-table ref="userTable" v-loading="loading" :data="userList" @selection-change="userHandleSelectionChange">
            <el-table-column label="选择" width="65">
              <template scope="scope">
                <el-radio :label="scope.row.id" v-model="templateRadio" @change.native="getTemplateRow(scope.$index,scope.row)">
                  &nbsp;</el-radio>
              </template>
            </el-table-column>
            <el-table-column label="编号ID" align="center" prop="id" hidden></el-table-column>
            <el-table-column label="标签名称" align="center" prop="name"></el-table-column>
            <el-table-column label="标签描述" align="center" prop="descr">
            </el-table-column>
          </el-table>
          <pagination
            v-show="userTotal>0"
            :total="userTotal"
            :page.sync="queryParams.pageNum"
            :limit.sync="queryParams.pageSize"
            @pagination="getUserSelectTags"
          />
          <el-input v-model="form.personTags" type="hidden"></el-input>
        </el-card>
        <el-card class="box-card" v-show="active==3" style="height:80%;overflow:auto;">
          <span style="font-weight: bold">模板选择</span>
          <el-divider></el-divider>
          <el-form-item label="触达通道" style="width:550px;">
            <el-select v-model="channelValue" placeholder="请选择通道"  @change="handleChannelChanges">
              <el-option
                v-for="dict in channelOptions"
                :key="dict.id"
                :label="dict.name"
                :value="dict.id"
              ></el-option>
            </el-select>
          </el-form-item>
          <el-form-item  label-width="120px;">

            <el-table v-loading="loading" :data="templateOptions" @selection-change="handleSelectionChange">
              <el-table-column label="选择" width="65">
                <template scope="scope">
                  <el-radio :label="scope.row.id" v-model="templateRadio" @change.native="getTemplateRow(scope.$index,scope.row)">
                    &nbsp;</el-radio>
                </template>
              </el-table-column>
              <el-table-column type="expand">
                <template slot-scope="props">
                  <el-form label-position="left" inline class="demo-table-expand">
                    <el-form-item label="模板报文">
                      <span>{{ props.row.templateMessage}}</span>
                    </el-form-item>
                  </el-form>
                </template>
              </el-table-column>
              <el-table-column label="模板编码" align="left" prop="templateCode"  ></el-table-column>
              <el-table-column label="模板名称" align="left" prop="templateName" ></el-table-column>
              <el-table-column label="下发方式" align="left" prop="downType"> </el-table-column>
            </el-table>

          </el-form-item>
          <pagination
            v-show="templateTotal>0"
            :total="templateTotal"
            :page.sync="queryParams.pageNum"
            :limit.sync="queryParams.pageSize"
            @pagination="getUserSelectTags"
          />
        </el-card>
        <el-row>
          <div class="dialog-footer" style="float:right;padding-top:10px;">
            <el-button @click="prev" v-if="active>1">上一步</el-button>
            <el-button @click="next" v-if="active<3">下一步</el-button>
            <el-button type="primary" @click="submitForm" v-show="active==3">发 布</el-button>
            <el-button @click="cancel">取 消</el-button>
          </div>
        </el-row>
      </el-form>
    </el-dialog>


  </div>
</template>
<style>

</style>
<script>
import {listPlan, getPlan, delPlan, addPlan, updatePlan, exportPlan} from "@/api/operate/equity";
import {getChannels, getChannTemplates, getUserTags} from "@/api/operate/plan";
import {listUser} from "@/api/system/user";
import {cardTypeOptions, listEquityitem, listEquityitemAll} from "@/api/config/equityitem";

export default {
  name: "equity",
  components: {},
  data() {
    return {
      active: 1,
      typeValue: "1",
      currentDays: [],
      templateRadio:undefined,
      userTagsId:undefined,
      userTypeValue:"1",
      finshStatus: 'success',
      dialogVisible: false,
      selectLength: 0,
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      userIds: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 总条数
      total: 0,
      userTotal: 0,
      templateTotal:0,
      // 运营计划表格数据
      planList: [],
      templateOptions:[],
      //受众用户
      userList: [],
      // 弹出层标题
      title: "",
      dateRange: "",
      // 是否显示弹出层
      open: false,
      // 状态字典
      statusOptions: [],
      // 类型字典
      typeOptions: [],
      equityTypeOptions:[],
      // 通道字典
      channelOptions: [],
      equityitemOptions:[],
      // 创建人字典
      createByOptions: [],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        name: undefined,
        status: undefined,
        beginDate: undefined,
        endDate: undefined,
        type: undefined,
        channel: undefined,
        latest: undefined,
        completePercent: undefined,
        allPercent: undefined,
        createBy: undefined,
      },
      // 表单参数
      form: {
        type: '1',
        touchType: '1',
        ruleTypes:[{name:'1111'},{name:'1111'}]
      },
      ruleTypes1:[''],
      ruleTypes2:[''],
      ruleTypes3:[''],
      ruleTypes4:[''],
      ruleTypes5:[''],
      ruleTypes6:[''],
      // 表单校验
      rules: {
        name: [
          {required: true, message: "名称不能为空", trigger: "blur"}
        ],
        channel: [
          {required: true, message: "触达通道为空", trigger: "blur"}
        ],
        status: [
          {required: true, message: "状态不能为空", trigger: "blur"}
        ],
        beginDate: [
          {required: true, message: "开始时间不能为空", trigger: "blur"}
        ],
        endDate: [
          {required: true, message: "接收时间不能为空", trigger: "blur"}
        ],
      }
    };
  },
  created() {
    this.getList();
    this.getUserSelectTags();
    this.getSelectChannels();
    this.getChannelsTemplate();
    this.getCurrentMonthDays();
    this.getCardTypeList();
    this.getDicts("sys_plan_status").then(response => {
      this.statusOptions = response.data;
    });
    this.getDicts("sys_plan_type").then(response => {
      this.typeOptions = response.data;
    });

    this.getDicts("sys_create_type").then(response => {
      this.createByOptions = response.data;
    });
  },
  methods: {
    /** 查询运营计划列表 */
    getList() {
      this.loading = true;
      listPlan(this.queryParams).then(response => {
        this.planList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    getChannelsTemplate(){
      var param={};
      getChannTemplates(param).then(response => {
        console.log(response.data);
        this.templateOptions = response.data;
        this.templateTotal=this.templateOptions.length;
        console.log('2222222222222222222');
      });
    },

    getSelectChannels(){
      getChannels().then(response => {
        this.channelOptions = response.data;
        this.channelValue=response.data[0].id;
      });
    },

    getCardTypeList(){
      var param={isEnable:'Y'};
      cardTypeOptions(param).then(response => {
        this.equityTypeOptions = response.rows;
      });
    },

    equityTypeChange(val){
      this.getCardItemList(val);
    },
    getCardItemList(type) {
      var param={isEnable:'Y',cardType:type};
      listEquityitemAll(param).then(response => {
        this.equityitemOptions = response.rows;
      });
    },

    getUserSelectTags(){
      getUserTags().then(response => {
        this.userList=response.data;
        this.userTotal=this.userList.length;
      });
    },
    selectCustType(obj) {
      this.getUserSelectTags();
    },
    getCurrentMonthDays() {
      this.currentDays = [];
      var date = new Date()
      var year = date.getFullYear();
      var month = date.getMonth() + 1;
      const lastDay = new Date(year, month, 0).getDate()
      for (let i = 1; i <= lastDay; i++) {
        this.currentDays.push(i + '号');
      }
    }
    ,
    // 状态字典翻译
    statusFormat(row, column) {
      return this.selectDictLabel(this.statusOptions, row.status);
    },


    equityTypeFormat(row, column) {
      var eventTypeName='';
      for(var i=0;i<this.equityTypeOptions.length;i++){
        if(this.equityTypeOptions[i].cardCode==row.type){
          eventTypeName=this.equityTypeOptions[i].cardType;
          break;
        }
      }
      return eventTypeName;
    },
    // 类型字典翻译
    typeFormat(row, column) {
      return this.selectDictLabel(this.typeOptions, row.type);
    },
    // 通道字典翻译
    channelFormat(row, column) {
      return this.selectDictLabel(this.channelOptions, row.channel);
    },
    // 创建人字典翻译
    createByFormat(row, column) {
      return this.selectDictLabel(this.createByOptions, row.createBy);
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: undefined,
        name: undefined,
        status: undefined,
        beginDate: undefined,
        endDate: undefined,
        type: undefined,
        channel: undefined,
        latest: undefined,
        completePercent: undefined,
        allPercent: undefined,
        createBy: undefined,
        createTime: undefined
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length != 1
      this.multiple = !selection.length
    },
    userHandleSelectionChange(selection) {
      this.userIds = selection.map(item => item.id)
      this.single = selection.length != 1
      this.multiple = !selection.length
      this.selectLength = this.userIds.length;
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "权益绑定";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getPlan(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改权益绑定";
      });
    },
    /** 提交按钮 */
    submitForm: function () {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != undefined) {
            updatePlan(this.form).then(response => {
              if (response.code === 200) {
                this.msgSuccess("修改成功");
                this.open = false;
                this.getList();
              } else {
                this.msgError(response.msg);
              }
            });
          } else {
            var array=new Array();
            for(let i=0;i<this.ruleTypes1.length;i++){
              var person = {eventType:this.ruleTypes1[i],eventKey:this.ruleTypes2[i],eventExpression:this.ruleTypes3[i],eventValue:this.ruleTypes4[i],eventRangeValue1:this.ruleTypes5[i],eventRangeValue2:this.ruleTypes6[i]}
              array.push(person);
            }
            console.log(array);
            this.form.ruleContent = JSON.stringify(array);
            this.form.touchType = this.typeValue;
            this.form.personTags=this.userTagsId;
            this.form.personType=this.userTypeValue;
            console.log(this.form.touchDateValue);
            addPlan(this.form).then(response => {
              if (response.code === 200) {
                this.msgSuccess("新增成功");
                this.open = false;
                this.getList();
              } else {
                this.msgError(response.msg);
              }
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$confirm('是否确认删除运营计划编号为"' + ids + '"的数据项?', "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(function () {
        return delPlan(ids);
      }).then(() => {
        this.getList();
        this.msgSuccess("删除成功");
      }).catch(function () {
      });
    },
    /** 导出按钮操作 */
    handleExport() {
      const queryParams = this.queryParams;
      this.$confirm('是否确认导出所有运营计划数据项?', "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(function () {
        return exportPlan(queryParams);
      }).then(response => {
        this.download(response.msg);
      }).catch(function () {
      });
    },
    next() {
      if (this.active > 2) {
        this.finshStatus = 'finish ';
        return;
      }
      this.active++;
    },

    prev() {
      if (this.active > 0) {
        this.active--;
      }
    },
    handleSelectAll() {
      this.userList.forEach(row => {
        this.$refs.userTable.toggleAllSelection();
      });
    },
    handleRemoveAll() {
      this.$refs.userTable.clearSelection();
    },

    selectPersonRule() {
      this.dialogVisible = false;
      this.form.personTags = this.userIds.join(',');
    },

    addRule(){
      this.ruleTypes1.push(this.ruleTypes1[this.ruleTypes1.length-1]);
      this.ruleTypes2.push(this.ruleTypes2[this.ruleTypes2.length-1]);
      this.ruleTypes3.push(this.ruleTypes3[this.ruleTypes3.length-1]);
      this.ruleTypes4.push(this.ruleTypes4[this.ruleTypes4.length-1]);
      this.ruleTypes5.push(this.ruleTypes5[this.ruleTypes5.length-1]);
      this.ruleTypes6.push(this.ruleTypes6[this.ruleTypes6.length-1]);
    },

    removeRule(){
      this.ruleTypes1.splice(this.ruleTypes1.length-1,1);
      this.ruleTypes2.splice(this.ruleTypes2.length-1,1);
      this.ruleTypes3.splice(this.ruleTypes3.length-1,1);
      this.ruleTypes4.splice(this.ruleTypes4.length-1,1);
      this.ruleTypes5.splice(this.ruleTypes5.length-1,1);
      this.ruleTypes6.splice(this.ruleTypes6.length-1,1);
    },
    getTemplateRow(index,row){
      this.templateRadio=row.id;
      this.userTagsId=row.id;
    }
  }
};
</script>
